<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
<head>
<title>Spring 3 MVC Series - EXAMPLE</title>

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
	function doAjax() {
		$.ajax({
			url : 'time.html',
			data : ({
				name : "me",
				tm	 : "test"
			}),
			success : function(data) {
				$('#time').html(data);
			}
		});
	}
</script>
</head>
<body>

	<h2>Contact Manager</h2>

	<button id="demo" onclick="doAjax()" title="Button">Get the
		time!</button>
	<div id="time"></div>
	
	&nbsp;
	<div id="ajxNotifications"></div>


	<form:form method="post" action="add.html" commandName="user">

		<table>
			<form:errors path="" />
			<tr>
				<td><form:label path="name">
						<spring:message code="label.name" />
					</form:label></td>
				<td><form:input path="name" /></td>
				<td><form:errors path="name" />
				</td>
			</tr>
			<tr>
				<td><form:label path="email">
						<spring:message code="label.email" />
					</form:label></td>
				<td><form:input path="email" /></td>
				<td><form:errors path="email" />
				</td>
			</tr>
			<tr>
				<td colspan="2"><input type="submit"
					value="<spring:message code="label.adduser"/>" />
				</td>
			</tr>
		</table>
	</form:form>
	
	<h4>Wiadomosc z jmx ${managedValue} </h4>

	<h3>Users</h3>
	<c:if test="${!empty usersList}">
		<table class="data">
			<tr>
				<th>Name</th>
				<th>Email</th>
				<th>Id</th>
				<th>&nbsp;</th>
			</tr>
			<c:forEach items="${usersList}" var="user">
				<tr>
					<td>${user.name}</td>
					<td>${user.email}</td>
					<td>${user.id}</td>
					<td><a href="delete/${user.id}.html">delete</a></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>

</body>
</html>